package Main;

import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Test {
    public static User Login() {
        System.out.println("请输入你的名字:");
        String name = new Scanner(System.in).next();
        System.out.println("请输入你的身份：1. 管理员   2. 普通用户");
        //接收标准输入流传入的数据
        int choice = new Scanner(System.in).nextInt();
        if (choice == 1) {
       /*     AdminUser user = new AdminUser(name);
            Admindooperation admindooperation = new Admindooperation();
                         admindooperation.option(user.menu(), bookList);*/
            return new AdminUser(name);
        } else {

           /* NormalUser user = new NormalUser(name);
            Normaldooperation normaldooperation = new Normaldooperation();
            normaldooperation.option( user.menu(),bookList);*/
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        //先创建一个书架
        BookList bookList1 = new BookList();
        //接收登录后返回的对象值：
        while (true) {
            User user = Login();
            int choice = user.menu();
            //调用业务类对象
            user.dooperation(choice, bookList1);

        }
    }
}


